package com.hq.ims.data.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hq.ims.data.entity.Dict;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @Email 526666031@qq.com
 * @Detail 字典主表DAO数据层
 */
@Repository
public interface DictMapper extends BaseMapper<Dict> {

    /**
     * 级联更新lv
     *
     * @param oldRootId    旧的rotoId
     * @param gtLv         大于等级
     * @param diffLv       列新的差值
     * @param updateRootId 需要更新的lv
     */
    @Update("udpate dict set lv += ${diffLv},root_id = #{updateRootId} where root_id = #{oldRootId} and lv > ${gtLv}} ")
    void cascadeLv(String oldRootId, int gtLv, int diffLv, String updateRootId);


    Dict getByType(String weatherInfoName);
}
